# send_email.py
from flask import render_template
from flask_mail import Message, Mail
from config import Config

mail = Mail()

def init_mail(app):
    mail.init_app(app)

def send_notification(subject, recipients, template, **kwargs):
    msg = Message(subject, recipients=recipients)
    msg.body = render_template(template + '.txt', **kwargs)
    msg.html = render_template(template + '.html', **kwargs)
    mail.send(msg)
